<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span id="flowsetname"></span><div class="move_title"></div><?php include "../public/subturn.php";?></div></div>
    <div class="main-container">
        <div class="block-generic">
            <?php include "../public/substt.php";?>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>印章外带信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>事项</label>
                        <div class="layui-input-block">
                            <input type="text" name="shi" id="shi" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>外带印章</label>
                        <div class="layui-input-block">
                            <input type="text" name="sealname" id="sealname" onclick="choose_seal_one()" readonly placeholder="请选择" clearable autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>预计返还日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="yudt" id="yudt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">备注</label>
                        <div class="layui-input-block">
                            <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>

            <?php include '../public/flowqita.php'?>
            <?php include '../public/upinfo.php'?>
        </div>
    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;
    chu_flow_edit_yushen();



    $("#commentForm").validate({
        rules: {
            shi: {required: true},
            sealname: {required: true},
            yudt: {required: true},
        },
        messages:{
            shi: {required: "请输入"},
            sealname: {required: "请选择"},
            yudt: {required: "请输入"},
        }
    });

    function choose_seal_one(obj){
        openPage('../public/choose_seal.php?choose_type=checkox&dom=sealname&page=seal_wai&state='+encodeURIComponent('正常'),'80%','80%')
    }

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_flowdata_edit_seal_wai, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                chu_flow_qian(data);


                $("#shi").val(data.shi);
                $("#sealname").val(data.sealname);
                $("#yudt").val(data.yudt);
                $("#explain").val(data.explain);
                public_upload_file_load('upload_files', res.data.files);

                render_from();
                initParseMoney();
            }
        });


        form.on('submit(add)', function(data){
            data.field.isturn = $(this).attr('key') || 0;
            data.field.isshen = $(this).attr('isshen') || 0;
            data.field.flowrelas = get_choose_val('flowrelas');
            data.field.advaners = tan_tags_getvalue("#advaners", 'user');
            data.field.nexter = tan_tags_getvalue("#nexter", 'user');


            if(data.field.isturn > 0){
                var validRes = $("#commentForm").valid();
                if(!validRes){return false;}
            }







            data.field.id = param_id;
            data = parseMoney(data);
            data.field.files = public_upload_file_value('upload_files');
            public_flow_submit(data.field, ask_flowdata_add_seal_wai, ask_flowdata_edit_seal_wai, $(this).attr('but'));
            return false;
        });

    });




</script>
</body>
</html>
